Skip to content

Add tutorials on UDEs with neural network rates#1489

Open
TorkelE wants to merge 23 commits into
masterfrom
add_ude_tutorial
Open

Add tutorials on UDEs with neural network rates#1489
TorkelE wants to merge 23 commits into
masterfrom
add_ude_tutorial

Conversation

@TorkelE

@TorkelE TorkelE commented Jun 15, 2026

Copy link
Copy Markdown
Member

Merging will likely require #1488 to be finished first (which in turn is waiting for the next OrdinaryDiffEq release).

@TorkelE TorkelE closed this Jun 24, 2026
@TorkelE TorkelE reopened this Jun 24, 2026

@sebapersson sebapersson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding, I think it looks good! Left a few minor comments

Lux.Dense(3 => 1, Lux.softplus, use_bias = false),
)
@SymbolicNeuralNetwork U, θ = nn_arch
A(z) = U(z, θ)[1]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use U([z, ]) syntax, makes it easier to understand how to have more than a single input to the neural network

```
Here, `U` represents the neural network structure, and `θ` represents its parameters. Additional options for using the `@SymbolicNeuralNetwork` macro are described [here](https://sciml.github.io/ModelingToolkitNeuralNets.jl/stable/api/#ModelingToolkitNeuralNets.@SymbolicNeuralNetwork) and [here](https://sciml.github.io/ModelingToolkitNeuralNets.jl/stable/symbolic_ude_tutorial/). Next, using the following syntax, we can [interpolate](@ref dsl_advanced_options_symbolics_and_DSL_interpolation) this function approximator as a Catalyst model rate.
```@example ude_rate_based
A(z) = U(z, θ)[1]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above


The UDE model can now be fitted to the data. Here, we use the Adam implementation from the
[Optimisers.jl](https://github.com/FluxML/Optimisers.jl) package, running 5 independent starts
with 10,000 iterations each.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
with 10,000 iterations each.
with 10,000 iterations/epochs each.

### [Learning parameters or observables using neural networks](@id udes_parameters_n_observables)
Throughout this tutorial, we have shown how neural networks can be incorporated into
Catalyst models to learn unknown functions of system variables within the main model
system. PEtab, however, also supports two additional ways to incorporate neural networks

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
system. PEtab, however, also supports two additional ways to incorporate neural networks
system. PEtab.jl, however, also supports two additional ways to incorporate neural networks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants